//
//  MyCouponCell.m
//  OrderSeat
//
//  Created by haiming on 13-10-9.
//  Copyright (c) 2013年 wangwei. All rights reserved.
//

#import "MyCouponCell.h"
#import "UIImageView+WebCache.h"


#define kIMAGE      1001
#define kCONTENT    1002
#define kSTARTIME   1003
#define kENDTIME    1004
@implementation MyCouponCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setContent:(NSDictionary *)dic
{
    NSString *image = [dic objectForKey:@"image"];
    NSString *content = [dic objectForKey:@"title"];
    NSString *start = [dic objectForKey:@"strat_time"];
    NSString *end = [dic objectForKey:@"end_time"];
    NSString *time = [NSString stringWithFormat:@"时间 %@-%@",start,end];
    NSString *status = [dic objectForKey:@"zhuangtai"];
    
    if ([content length] > 40) {
        content = [[content substringToIndex:40] stringByAppendingString:@"..."];
    }
    
    NSURL *url = [NSURL URLWithString:image];
    [_logoImage setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeImage"]];
    _contentLabel.text = content;
    _activityTimeLabel.text = time;
    _statusLabel.text = status;
    
    if ([status isEqualToString:@"过期"]) {
        _statusLabel.textColor = [UIColor colorWithHexString:@"#999999"];
    }
    
    [self reLayoutSubviews];
}

- (void)reLayoutSubviews
{
    [_view drawBorder];
    [_contentLabel autoHeightForMutiLines];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


@end
